﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ClientApp
{
    interface IDatabase
    {
        // Initialize
        void Initialize(string connectionString);
        void CreateInitialData();
        void DropTables();

        // Get
        List<Vacancy> ActiveVacancies();
        List<Vacancy> FilledVacancies();

        // Common Get
        List<Skill> Skills();
        List<Employer> Employers();
        List<Candidate> Candidates();
        List<Bargain> Bargains();
        List<Activity> Activities();
        List<Vacancy> Vacancies();

        // Get By ID
        Employer EmployerByID(uint id);
        Candidate CandidateByID(uint id);
        Skill SkillByID(uint id);
        Bargain BargainByID(uint id);
        Activity ActivityByID(uint id);
        Vacancy VacancyByID(uint id);

        // Get By Title or Login
        Vacancy VacancyByTitle(string title);
        Employer EmployerByTitle(string title);
        Activity ActivityByTitle(string title);
        Skill SkillByTitle(string title);
        Employer EmployerByLogin(string login);
        Candidate CandidateByLogin(string login);

        List<Skill> SkillsListedByVacancies(); // по всем открытым вакансиям вернуть общий список навыков
        List<Vacancy> Vacancies(Activity acivity, List<Skill> skills, uint salary);
        List<Candidate> Candidates(List<Skill> skills, Point location, int distance);
        List<Bargain> EmployerBargains(Employer employer);
        List<Vacancy> Vacancies(Activity activity);
        SortedSet<uint> SkillIds(ListBox.SelectedObjectCollection items); // items[i]->ToString() - Skill Title
        List<KeyValuePair<string, int>> MostRequestedSkills();
        List<KeyValuePair<string, int>> TopDealEmployers();

        // Add
        bool Add(Employer employer);
        bool Add(Candidate candidate);
        bool Add(Vacancy vacancy);
        bool Add(Bargain bargain);
        bool Add(Skill skill);
        bool Add(Activity activity);

        // Remove
        bool Remove(Candidate candidate);
        bool Remove(Employer employer);
        bool Remove(Vacancy Vacancy);
        bool Remove(Skill skill);
        bool Remove(Activity activity);
        bool Remove(Bargain bargain);
        bool RemoveEmployerByName(string employerName);
        bool RemoveVacancyByID(uint vacancyId);

        // Check
        bool CandidateExists(string login);
        bool EmployerExists(string login);
    }
}
